#include "dialog.h"
#include<QPushButton>
#include<QLabel>
#include<QVBoxLayout>

Dialog::Dialog(QWidget *parent):QDialog(parent)
{
    //创建控件,加入到 dailog
    QVBoxLayout*layout = new QVBoxLayout();
    this->setLayout(layout);

    QLabel * label = new QLabel("这是一个对话框",this);
    QPushButton*button = new QPushButton("关闭",this);
    layout->addWidget(label);
    layout->addWidget(button);

    connect(button,&QPushButton::clicked,this,&Dialog::handl);
}

void Dialog::handl()
{
    this->close();
}
